<!-- 头部 -->
<include file="Public:header" />

        <div class="index-wrapper" style="padding-bottom: 10px;">
            <!-- banner-section start -->
            <div class="banner-section" style="height:100%;">
                <img src="__PUBLIC__{$xm_info.xm_img}" class="banner-img" style="height: 100%;">
            </div>
            <!-- banner-section end -->

            <!-- 楼层显示 -->
            <div class="img-floor border-grids product-recom" style="height: 80px;">
                <div class="floor-title">
                    <div class="ui-flex total-centent" style="height: 10.4rem;">
                        <a href="{:U('index/qx',array('id'=>$id))}" class="cell">
                            <span class="total-text" style="padding-top: 20px;font-size: 20px;">物品动态</span>
                        </a>
                        <span style="width: 1px;height: 90px;background: #F2F2F2;"></span>
                        <a class="cell">
                            <span class="total-text" style="padding-left: 10px;padding-top: 20px;font-size: 20px;">
                                爱心 <font style="color:#FF8814;">{$xm_info.xm_num}</font> (份)
                            </span>
                        </a>
                    </div>
                </div>
            </div>

            <div style="background: #fff;">
                <div style="height: 50px;border-bottom: 2px solid #FF8711;text-align: center;">
                    <a href="{:U('index/xm',array('id'=>$id))}" style="line-height: 50px;font-size: 20px;">项目详情</a>
                    <a href="{:U('index/msg',array('id'=>$id))}" style="padding-left: 40px;line-height: 50px;font-size: 20px;color:#FF8711;">爱心留言</a>  
                </div>
                <div style="padding: 20px;">
                    <form class="layui-form" method="post">
                        <textarea name="msg" lay-verify="msg" cols="30" rows="5" style="width: 100%;" placeholder="请出入评论内容"></textarea>

                        <input type="hidden" name="xm_id" value="{$id}">
                        <input type="hidden" name="names" value="{$_SESSION['name']}">
                        <input type="hidden" name="phone" value="{$_SESSION['phone']}">

                        <button lay-submit="" lay-filter="*" style="width: 100%;position: relative;top: -4px;" id="tijiaobtn">提交评论</button>
                    </form>
                </div>
                <div style="width: 100%;">
                    <p style="background: #F3F3F3;padding: 10px 15px;">评论</p>
                    <?php foreach ($comms as $v) { ?>
                    <div style="padding: 10px;font-size: 8px;border: 1px solid #c7bdbd;">
                        <span style="padding-left: 10px;font-size: 18px;">{$v.name}</span> <span><?php echo date('Y-m-d H:i:s',$v['time'])?></span>
                        <span style="position: absolute;right: 20px;">手机：<?php echo substr_replace($v['phone'],'*****',3,5) ?></span>
                        <p style="padding: 10px;">
                            <textarea cols="30" rows="5" style="width: 100%;border: 0px;background: #f5f1f1;">{$v.msg}</textarea>
                        </p>
                    </div>
                    <?php } ?>
                </div>
            </div>
            
            <!-- <div class="tabbar-section">
                <ul id="J-tabbar" class="ui-flex tabbar-content">
                    <li class="cell J-other">
                        <a class="tabbar-nav" href="{:U('index/jw',array('xm_id'=>$xm_info['id']))}">
                            <span style="background: #FF8711;width: 80%;">我要捐赠</span>
                        </a>
                    </li>
                    <li class="cell J-other">
                        <a class="tabbar-nav" href="{:U('index/jw',array('xm_id'=>$xm_info['id']))}">
                            <span style="background: #FF8711;width: 80%;">发起一起捐</span>
                        </a>
                    </li>
                </ul>
            </div>
 -->
            <div style="text-align: center;font-size: 12px;padding-top: 10px;">
                <span>投诉与建议：020-39936776</span>
                <p style="font-size: 18px;">小尚公益</p>
            </div>
        </div>
<script type="text/javascript">
    layui.use(['form','layer'], function(){
       $ = layui.jquery;
      var layer = layui.layer
      ,form = layui.form();
      //layer.msg('Hello World');
    //自定义验证规则
    form.verify({
      msg: function(value){
        if(value.length < 1){
          return '请出入评论内容';
        }
      }
    });

      //交互
    form.on('submit(*)', function(data){
        $.ajax({
            url: "{:U('index/msg')}",//请求地址
            type: "post",//请求方式
            dataType: "json",//返回数据类型
            data: data.field,//发送的参数
            })
            .done(function(response) {
                  if(response.error==0){
                     layer.msg(response.info ,{icon:5});
                     location.href = response.url;
                  }else{
                     layer.msg(response.info ,{icon:6});
                     location.reload();
                  }
              })
            .fail(function() {
                alert("ajxs交互失败");
            })  

          return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });   
    });

    /*发送短信验证码*/
    // function get_mobile_valid(){
    //     layer.confirm('确认要发送吗？',function(index){
    //         //发异步删除数据
    //         var to = $('input[name="phone"]').val();
    //         $.ajax({
    //             url: "{:U('index/send_to')}",//请求地址
    //             type: "post",//请求方式
    //             dataType: "json",//返回数据类型
    //             data: {to:to},//发送的参数
    //             })
    //             .done(function(response) {
    //                   if(response.error==1){
    //                     layer.msg(response.info ,{icon:6});
    //                   }else{
    //                     layer.msg(response.info ,{icon:5});
    //                   }
    //               })
    //             .fail(function() {
    //                 alert("ajxs交互失败");
    //             })  
    //         return false;
    //     });
    // }
</script>

    </body>
</html>